const { onMounted, onUnmounted, ref } = Vue;
export function usePosition() {
  const x = ref('')
  const y = ref('')
  onMounted(() => {
    document.addEventListener('mousemove', getMousePosition)
  })
  onUnmounted(() => {
    document.removeEventListener('mousemove', getMousePosition)
  })
  function getMousePosition(e) {
    x.value = e.pageX
    y.value = e.pageY
  }
  return {
    x, y
  }
}
